<?php
$headMenus = $this->getHeadMenus()->getData();
$navMenus = $this->getNavMenus()->getData();
$regist = $this->getUserModel();
$login = $this->getLoginForm();
$roomList = $this->getRoomList()->getData();
$isGuest = Yii::app()->user->isGuest;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<link rel="stylesheet" type="text/css" href="css/base.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/lightbox.css" />
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/my-js.js"></script>
<script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<link href="css/97zzw_com.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.roundabout.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/lightbox.min.js"></script>
<script type="text/javascript">
	function changeURLArg(url,arg,arg_val){
		var pattern=arg+'=([^&]*)';
		var replaceText=arg+'='+arg_val;
		if(url.match(pattern)){
			var tmp='/('+ arg+'=)([^&]*)/gi';
			tmp=url.replace(eval(tmp),replaceText);
			return tmp;
		}else{
			if(url.match('[\?]')){
				return url+'&'+replaceText;
			}else{
				return url+'?'+replaceText;
			}
		}
		return url+'\n'+arg+'\n'+arg_val;
	}
	$(function(){
		$('.nav td').bind('click', function() {
			$.cookie('link_url', $(this).html());
			$.cookie('link_text', $(this).find('a').html());
		});
		$('.otherMenu li').bind('click', function() {
			$.cookie('link_url', $(this).html());
			$.cookie('link_text', $(this).find('a').html());
		});
		$('.top_link').bind('click', function() {
			$.cookie('link_url', $(this).attr('href'));
			$.cookie('link_text', $(this).html());
		});
		$('.kf-right a').bind('click', function() {
			var url = $(this).attr("url");
			$.cookie('link_url', '<a href="'+url+'">特别优惠</a>');
			$.cookie('link_text', $(this).find('a').html());
		});
		$('#sysSubNav').html($.cookie('link_url'));
		$('#sysSubText').html($.cookie('link_text'));
	});
</script>
</head>

<body style="overflow: hidden; overflow-y: auto;">
<div class="container" id="page">

<div class="header-bj"><!--头部-->
<div class="header"><a href="index.php"><img class="mt15"
	src="images/logo.png" /></a>
<div class="fr mt19">
<div>
	<span class=" ml35">预定热线：86-28-8719 8677</span> 
	<span class="ml35">
		<?php if ($isGuest) : ?>
			<a id="register" href="javascript:void(0)">加入青城会</a>&nbsp;|&nbsp;
			<a id="login" href="javascript:void(0)">登录</a> 
		<?php endif; ?>
		<?php if (!$isGuest) : ?>
			<span>欢迎您，<?php echo Yii::app()->user->getState("userName") ?></span>&nbsp;|&nbsp; 
			<a href="?r=user/member" class="top_link">个人中心</a> 
		<?php endif; ?>
		<a class="ml10 top_link" href="?r=question">常见问题</a> 
		<a class="ml20" href="javascript:void(0)">Englsh 》</a> 
	</span>
</div>
<ul class="mt19 otherMenu">
<li><a href="index.php">首页</a></li>
<li>|</li>
<li><a href="?r=general/about">关于酒店</a></li>
<li>|</li>
<li><a href="?r=news">酒店新闻</a></li>
<li>|</li>
<li><a href="?r=photo">酒店相册</a></li>
<li>|</li>
<li><a href="?r=suggest">互动社区</a></li>
<li>|</li>
<li><a href="?r=general/job">工作机会</a></li>
<li>|</li>
<li><a href="?r=general/contact">联系我们</a></li>
<?php
//foreach ( $headMenus as $key => $value ) {
//	if ($key > 0) {
//		echo '<li>|</li>';
//	} 
//	echo '<li><a href="?r=content&type='. $value ["id"].'">' . $value ["name"] . '</a></li>';
//}
?>
</ul>
</div>
</div>
<!--头部结束--> <!--导航-->
<div class="nav fwb">
<div style="margin-left: 10px; margin-right: 10px;">
<table style="width: 100%;" class="nav_table">
	<tr style="line-height: 35px;">
		<td><a id="yd" href="javascript:void(0)">网上订房</a></td>
		<td><a id="yd" href="?r=room">舒适客房</a></td>
		<?php
		foreach ( $navMenus as $key => $value ) {
			echo '<td>';
			echo '<a href="?r=content&type=' . $value ["id"] . '">' . $value ['name'] . '</a>';
			echo '</td>';
		}
		?>
	</tr>
</table>
</div>
<ul class="abs">
</ul>
<form action="?r=order/step1" method="post">
<div class="index-df" style='display:<?php
if (! strpos ( $_SERVER ["REQUEST_URI"], "?" )) {
	echo "block";
} else {
	echo "none";
}
?>;'><a class="fr mr10 mt5" id="outyd" href="javascript:void(0)"><img src="images/xx.png" /></a>
<p class="mt10">入住时间</p>
<p class="mt5"><input type="text" name="in_date" onClick="WdatePicker()"
	class="index-df-input " value="<?php if (!empty($_SESSION['in_date'])) echo $_SESSION['in_date'];?>" /></p>
<p class="mt10">退房时间</p>
<p class="mt5 mb10"><input type="text" name="out_date" onClick="WdatePicker()"
	class="index-df-input" value="<?php if (!empty($_SESSION['out_date'])) echo $_SESSION['out_date'];?>"/></p>
<div class="dn" id="ew">
<p>选择房型</p>
<p class="mt5">
<select class="index-df-input" name="room_type">
	<?php
	foreach ($roomList as $key => $value ) {
		if (!empty($_SESSION["room_type"]) && $_SESSION["room_type"] === $value["id"])
			echo '<option value="'.$value["id"].'" selected="selected">'.$value["name"].'</option>';
		else 
			echo '<option value="'.$value["id"].'">'.$value["name"].'</option>';
	}
	?>
</select>
</p>
<p class="mt10" style="display: none;"><input type="checkbox" /> <span class="ml5">使用会员积分</span></p>
<p class="mt10">
<center>
<?php if (!$isGuest) : ?>
	<input class="button" type="submit" value="立即预定" />
<?php endif; ?>
<?php if ($isGuest) : ?>
	<a href="javascript:void(0)" id="loginOrder">
		<input class="button" type="button" value="登录预定" />
	</a>
<?php endif; ?>
</center>
</p>
<?php if ($isGuest) : ?>
	<p class="mt5 mb5">想获得更多优惠，请<a id="register_b" class="c-t-c"
	style="margin-left: 0px;" href="javascript:void(0)">加入青城会。</a></p>
<?php endif; ?>
</div>
</div>
</form>
</div>
<!--导航结束--></div>
<?php echo $content; ?>
<div class="clear"></div>
<!--底部-->
<div class="copyright-bj">
<div class="copyright">
<center>
<p class="ml82">成都建工集团旅游有限公司 青城(豪生)国际酒店 总机：+86（28）8898 8888</p>
<p>蜀ICP备09015409号 Copyright © 2012 Howard Johnson Conference Resort
Chengdu. All rights reserved.</p>
</center>
</div>
</div>
<!--底部结束--></div>
<!-- page -->
<!--用户登录起始-->
<div class="login dn">
<div class="login-banner">
<div class="banner-text">青城会
	<img id="x" class="pop_login_close" src="images/xx.png" alt="取消" /></div>
</div>
<div class="register-content" style="margin-top: 10px;">
<div class="loginimg2"><img class="fl mr20" src="images/zsdfag.png" />
<p class="aa">青城会</p>
<p class="bb">我们将为会员提供更细致的服务</p>
</div>
<div class="login-table">
	<?php $form=$this->beginWidget('CActiveForm', array(
			'id'=>'login-form',
			'htmlOptions'=>array(
				'onsubmit'=>'return submitLogin()'
			)
		)); ?>
<table>
	<tr>
		<td class="login-td" width="80">用户名：</td>
		<td>
			<?php echo $form->textField($login,'username', array(
				'class'=>'login-input',
				'minLength'=>6,
				'minError'=>'用户名应大于6个字符',
				'maxLength'=>12,
				'maxError'=>'用户名不能超过12个字符',
				'blankError'=>'请输入用户名'
			)) ?>
		</td>
	</tr>
	<tr>
		<td class="login-td">密码：</td>
		<td>
			<?php echo $form->passwordField($login,'password', array(
				'class'=>'login-input',
				'minLength'=>6,
				'minError'=>'密码长度不足6位',
				'maxLength'=>16,
				'maxError'=>'密码不能超过16位',
				'blankError'=>'请输入密码'
			)) ?>
		</td>
	</tr>
	<tr>
</table>
<div style="margin-left: 60px;float: left;">
	<input type="image" src="images/wrthwrfg.png" class="login-now" style="border:0px;" alt="login" />
</div>
<div style="margin-top: 25px; margin-left:210px;color: #000000;">
	<a href="javascript:void(0)" style="color: #000000;" id="loginRegist">立即注册</a>
</div>
<?php $this->endWidget(); ?>
</div>
</div>
</div>
<script type="text/javascript">
	$("#loginRegist").click(function(){
		$(".login").toggle();
		$(".register").css('top', (window.screen.height - 110 - $(".register").height()) / 2);
		$(".register").css('left', (window.screen.width - $(".register").width()) / 2);
		$(".register").toggle();
	});
	function submitLogin(){
		if (!validForm('login-table'))
		{
			return false;
		}
		var data=$("#login-form").serialize();
		$.ajax({
			url: '<?php echo Yii::app()->createAbsoluteUrl("user/login"); ?>',
			type: 'POST',
			data: data,
			success: function(msg) {
				if (msg == 'success')
				{
					location.reload();
				}
				else
				{
					alert('登录失败，用户名或密码错误！');
				}
			}
		});
		return false;
	}
</script>
<!--用户登录结束-->
<!--用户注册-->
<div class="register dn">
<div class="register-banner">
<div class="banner-text">青城会 <a id="outregister" href="javascript:void(0)"><img id="x"
	src="images/xx.png" alt="cancel" /></a></div>
</div>
<div class="register-content">
<div class="img2"><img class="fl mr20" src="images/zsdfag.png" />
<p class="aa">青城会</p>
<p class="bb">我们将为会员提供更细致的服务</p>
</div>
<div class="register-table">
		<?php $form=$this->beginWidget('CActiveForm', array(
			'id'=>'regist-form',
			'htmlOptions'=>array(
				'onsubmit'=>'return submitRegist()'
			)
		)); ?>
	<table>
	<tr>
		<td class="login-td" width="90">用户名:</td>
		<td>
			<?php echo $form->textField($regist,'user_name', array(
				'class'=>'login-input',
				'minLength'=>6,
				'minError'=>'用户名不能少于6个字符 ',
				'maxLength'=>12,
				'maxError'=>'用户名不能超过12个字符'
			)) ?>
		</td>
		<td class="register-warning2">
			<span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg">6-12位数字、字母组合</span>
		</td>
	</tr>
	<tr>
		<td class="login-td">密码:</td>
		<td>
			<?php echo $form->passwordField($regist,'password', array(
				'class'=>'login-input',
				'minLength'=>6,
				'minError'=>'密码不能少于6个字符 ',
				'maxLength'=>16,
				'maxError'=>'密码不能超过16个字符 ',
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg">6-16个字符</span></td>
	</tr>
	<tr>
		<td class="login-td">确认密码:</td>
		<td>
			<?php echo $form->passwordField($regist,'password2', array(
				'class'=>'login-input',
				'minLength'=>6,
				'maxLength'=>16
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
	<tr>
		<td class="login-td">姓名：</td>
		<td>
			<?php echo $form->textField($regist,'name', array(
				'class'=>'login-input',
				'minLength'=>1,
				'minError'=>'姓名不能少于1个字符 ',
				'maxLength'=>6,
				'maxError'=>'姓名不能超过6个字符 ',
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
	<tr>
		<td class="login-td">性别:</td>
		<td class="register-gender">
			<?php echo $form->radioButtonList($regist,'gender', array(
				'1'=>'男',
				'0'=>'女'
			), array(
				'separator'=>'&nbsp;&nbsp;&nbsp;&nbsp;'
			) ) ?>
		</td>
	</tr>
	<tr>
		<td class="login-td">联系手机：</td>
		<td>
			<?php echo $form->textField($regist,'mobile', array(
				'class'=>'login-input',
				'minLength'=>13,
				'minError'=>'手机号码不能少于13位 ',
				'maxLength'=>18,
				'maxError'=>'手机号码不能超过18位'
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
	<tr>
		<td class="login-td">电子邮箱：</td>
		<td>
			<?php echo $form->emailField($regist,'email', array(
				'class'=>'login-input',
				'min'=>6,
				'maxLength'=>64
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
	<tr>
		<td class="login-td">证件号码：</td>
		<td>
			<?php echo $form->textField($regist,'id_card', array(
				'class'=>'login-input'
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
	<tr>
		<td class="login-td">联系地址：</td>
		<td>
			<?php echo $form->textField($regist,'address', array(
				'class'=>'login-input',
				'min'=>6,
				'maxLength'=>64
			)) ?>
		</td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
	<tr>
		<td class="login-td">验证码：</td>
		<td style="text-align:left;">
			<?php echo $form->textField($regist,'verifyCode', array(
				'class'=>'login-input',
				'minLength'=>4,
				'maxLength'=>4,
				'style'=>'width:50px;float:left;'
			)) ?>
			<div style="height:100%;">
				<?php if (CCaptcha::checkRequirements ()) : ?>
    				<?php $this->widget ( 'CCaptcha', array (
    					'showRefreshButton' => false, 
    					'clickableImage' => true, 
    					'captchaAction'=>'user/captcha',
    					'imageOptions' => array (
    						'title' => '刷新验证码', 
    						'alt' => '刷新验证码', 
    						'style' => 'margin-left:5px;margin-top:-2px;'
    						) 
    					) 
    				);?> 
					<?php endif; ?>
			</div>
        </td>
		<td class="register-warning2"><span style="color:red;margin-right:5px;">*</span>&nbsp;<span class="regist-msg"></span></td>
	</tr>
</table>
<div>
<input type="image" class="register-now" src="images/rjertet.png" style="border:0px;">
</div>
<?php $this->endWidget(); ?>
<script type="text/javascript">
	function submitRegist(){
		if (!validForm('register-table'))
		{
			return false;
		}
		var data=$("#regist-form").serialize();
		$.ajax({
			url: '<?php echo Yii::app()->createAbsoluteUrl("user/regist"); ?>',
			type: 'POST',
			data: data,
			success: function(msg) {
				if (msg == 'success')
				{
					alert('注册成功！');
					location.reload();
				}
				else
				{
					alert(msg);
				}
			}
		});
		return false;
	}
</script>
</div>
</div>
</div>
<!--用户注册-->
<!--页面主体结束-->
</body>
</html>
